package com.room.search.service;

import com.room.search.domain.RoomBasicProperty;
import com.room.search.repository.RoomBasicPropertyRepository;
import com.room.search.repository.search.RoomBasicPropertySearchRepository;
import com.room.search.service.dto.RoomBasicPropertyDTO;
import com.room.search.service.mapper.RoomBasicPropertyMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * Service Implementation for managing {@link RoomBasicProperty}.
 */
@Service
@Transactional
public class RoomBasicPropertyService {

    private final Logger log = LoggerFactory.getLogger(RoomBasicPropertyService.class);

    private final RoomBasicPropertyRepository roomBasicPropertyRepository;

    private final RoomBasicPropertyMapper roomBasicPropertyMapper;


    public RoomBasicPropertyService(
        RoomBasicPropertyRepository roomBasicPropertyRepository,
        RoomBasicPropertyMapper roomBasicPropertyMapper) {
        this.roomBasicPropertyRepository = roomBasicPropertyRepository;
        this.roomBasicPropertyMapper = roomBasicPropertyMapper;
    }


    @Transactional
    public RoomBasicProperty save(RoomBasicPropertyDTO basicProperty) {
        log.info("保存房源的基本熟悉：{}",basicProperty);
        RoomBasicProperty property = roomBasicPropertyMapper.toEntity(basicProperty);
        return roomBasicPropertyRepository.save(property);
    }
}
